package com.fast.admin;

import com.fast.admin.common.config.EnableShiro;
import com.fast.common.base.service.impl.RedisService;
import com.fast.common.config.CommonConfig;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;

import javax.validation.Validator;

/**
 * @Title：启动类
 * @author：ylc
 * @date：2018/7/12 16:54
 * @version：1.0
 **/
@SpringBootApplication
@EnableShiro
@EnableTransactionManagement
@MapperScan("com.fast.admin.mapper")
public class AdminApp {
    @Bean
    public HttpMessageConverters httpMessageConverters() {
        return new CommonConfig().fastJsonMessageCoverters();
    }

    @Bean
    MethodValidationPostProcessor methodValidationPostProcessor() {
        return new CommonConfig().methodValidationPostProcessor();
    }

    @Bean
    public Validator validator() {
        return new CommonConfig().validator();
    }

    @Bean
    public RedisService redisService(){
        return new RedisService();
    }

    public static void main(String[] args) {
        SpringApplication.run(AdminApp.class, args);
    }
}
